programming4us
           
 
 
Windows

SOA with .NET and Windows Azure : Windows Workflow Foundation (part 6)

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
12/19/2010 4:39:01 PM

Passing Parameters into a Workflow Instance

Parameters are passed to a workflow instance using the Dictionary object. The CreatWorkflow operation has an overloaded operation that takes not only the workflow type but also a Dictionary object that accepts parameters. The code fragment in this next example demonstrates this:

Example 2.
Type type = typeof(WFWorkflow.CalcWorkflow);
Dictionary<string, object>
parameters = new Dictionary<string, object>();
parameters.Add("Value1", 11);
parameters.Add("Value2", 19);
parameters.Add("Operation", "+");
WorkflowInstance instance =
workflowRuntime.CreateWorkflow(type, parameters);
instance.Start();

Returning Parameters from a Workflow Instance

The WorkflowCompletedEventArgs in the WorkflowCompleted event returns an output parameter, as shown here:

Example 3.
AutoResetEvent waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted
+= delegate
(object sender,
WorkflowCompletedEventArgs e)
{
int total = (int)e.OutputParameters["Result"];
Console.WriteLine(total);
waitHandle.Set();
};

Output parameters are collections and data is extracted from collection and cast into an integer. The names of the input parameters passed into the workflow instance automatically map to the names of properties defined inside the workflow class. In this case, the Result property maps directly to the result parameter returned. The input properties are used to initialize private variables in the workflow instance:

Example 4.
public partial class CalcWorkflow :
SequentialWorkflowActivity
{
private int value1 = 0;
private int value2 = 0;
private int result = 0;
private String operation;

public int Value1
{
set{value1 = value;}
}
public int Value2
{
set{value2 = value;}
}
public string Operation
{
set{operation = value;}
}
public int Result
{
get{return result;}
}
private void Calculator_ExecuteCode
(object sender, EventArgs e)
{
if (operation == "+")
{result = value1 + value2;}
}
}


Other -----------------
- Windows 7 : Creating and Enforcing Bulletproof Passwords (part 3) - Recovering from a Forgotten Password
- Windows 7 : Creating and Enforcing Bulletproof Passwords (part 2) - Taking Advantage of Windows 7’s Password Policies
- Windows 7 : Creating and Enforcing Bulletproof Passwords (part 1)
- Windows 7 : Understanding User Account Control (part 3) - User Account Control Policies
- Windows 7 : Understanding User Account Control (part 2) - Configuring User Account Control
- Windows 7 : Understanding User Account Control (part 1) - Elevating Privileges
- Windows 7 : Encrypting a Disk with BitLocker (part 2) - Enabling BitLocker on a System Without a TPM
- Windows 7 : Encrypting a Disk with BitLocker (part 1) - Enabling BitLocker on a System with a TPM
- Windows 7 : Securing the File System - Encrypting Files and Folders
- SOA with .NET and Windows Azure : Service Consumers with WCF
- Windows 7 : Setting Security Permissions on Files and Folders (part 5) - Assigning Special Permissions
- Windows 7 : Setting Security Permissions on Files and Folders (part 4) - Assigning Standard Permissions
- Windows 7 : Setting Security Permissions on Files and Folders (part 3) - Assigning a User to Multiple Security Groups
- Windows 7 : Setting Security Permissions on Files and Folders (part 2) - Assigning a User to a Security Group
- Windows 7 : Setting Security Permissions on Files and Folders (part 1) -
- Cloud-Enabling the ESB with Windows Azure (part 2) - Sending Messages to Azure’s AppFabric Service Bus
- Cloud-Enabling the ESB with Windows Azure (part 1) - Receiving Messages from Azure’s AppFabric Service Bus
- Windows 7 : Sending and Receiving Secure Email (part 2) - Obtaining Another Person’s Public Key
- Windows 7 : Sending and Receiving Secure Email (part 1) - Setting Up an Email Account with a Digital ID
- Windows 7 : Maintaining Your Privacy While Reading Email
 
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
- First look: Apple Watch

- 3 Tips for Maintaining Your Cell Phone Battery (part 1)

- 3 Tips for Maintaining Your Cell Phone Battery (part 2)
programming4us programming4us